package com.srcpoint.common.tips.core
{
    import flash.utils.*;

    public class TipPool extends Object
    {
        private static var toolTipDic:Dictionary = new Dictionary();

        public function TipPool()
        {
            return;
        }// end function

        public static function getToolTip(cls:Class) : ITip
        {
            if (toolTipDic[cls] == null)
            {
                toolTipDic[cls] = new Vector.<ITip>();
            }
            var vector:Vector.<ITip> = toolTipDic[cls];
            var len:int = vector.length;
            var i:int = 0;
            while (i < len)
            {
                if (vector[i].invalid == true)
                {
                    vector[i].invalid = false;
                    return vector[i];
                }
                i++;
            }
            var nTip:ITip = new cls as ITip;
            vector.push(nTip);
            return nTip;
        }// end function

    }
}
